<template>
	<!-- 苹果手机和安卓手机的pdf预览页 -->
	<view style="width: 100%;">
		<web-view :src="allUrl"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				allUrl: "",
				// 适配安卓手机端的pdf预览路径
				viewerUrl: '/static/pdf/web/viewer.html', // 用来渲染PDF的html
			}
		},
		onLoad(options) {

			// 报表过来使用
			if (options.type) {
				let item = JSON.parse(uni.getStorageSync('item'))
				let allUrl = options.url + '&lng=' + options.lng + '&authToken=' + options.authToken
				// this.allUrl = encodeURIComponent(allUrl)
				this.allUrl = "http://192.168.1.224:82/Wyn_ReportManage/Wyn_ReportInfo/MyReports?token=" + uni
					.getStorageSync('token') + '&Id=' + uni.getStorageSync('UserInfo').UserInfo.Id + '&ReportName=' + item
					.ReportName + '&ReportUrl=' + item.ReportUrl
				console.log('获取报表报表博爱表过来的url拼接的地址信息', allUrl, item)
				return
			}
			// 适配苹果手机端pdf预览
			if (options.PhoneType === 'ios') {
				this.allUrl = options.url

				return
			}

			// 适配安卓端pdf预览
			// pdf预览过来使用
			this.allUrl = this.viewerUrl + '?file=' + encodeURIComponent(options.url);

		}
	}
</script>

<style lang="less" scoped>
</style>